<template>
	<view class="page">
		<fu-custom bgColor="bg-white" :isBack="true" :isBottom="true">
			<block slot="content">{{i18n['消息详情']}}</block>
		</fu-custom>
		<!-- 页面加载 start -->
		<fu-loading v-if="isShowLoading"></fu-loading>
		<!-- 页面加载 end -->
		<block v-else>
			<!-- 文章标题 start -->
			<view class="title">{{ detail.title }}</view>
			<view class="time">{{ detail.add_time }}</view>
			<!-- 文章标题 end -->

			<!-- 文章详情 start -->
			<view class="article-detail">
				<jyf-parser :html="body"></jyf-parser>

			</view>
			<fu-empty-ui v-if="detail=='' "></fu-empty-ui>
			<!-- 文章详情 end -->
		</block>

		<!-- 网络检测 start -->
		<fu-notwork></fu-notwork>
		<!-- 网络检测 end -->
	</view>
</template>

<script>
	import richText from "@/common/utils/richText.js";
	export default {
		data() {
			return {
				isShowLoading: false, //页面加载loading

				id: "",
				detail: "",
				content: "",
				body: "",
				type:'',//消息类型
			};
		},
		onLoad(options) {
			this.id = options.id;
			this.type = options.type;
		},
		onShow() {
			this.getData();
		},
		methods: {
			getData() {
				var self = this;
				this.$api
					.post(global.apiUrls.postOperationGetArticleDetail, {
						id: this.id,
					})
					.then((res) => {
						console.log(res.data);
						self.detail = res.data.data;
						if (res.data.data.body) {
							self.body = richText.format(res.data.data.body);
						}
						self.isCollect = res.data.data.is_collection;
						uni.hideLoading();
					});
			},
		},
	};
</script>

<style lang="scss">
	.page {
		background-color: white;
		height: 100%;
		height: 100vh;
	}

	/* 文章标题 start */
	.title {
		padding: 32upx 32upx 0;
		/* height: 99rpx; */
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 500;
		line-height: 54rpx;
		color: #333333;
		opacity: 1;
	}

	.time {
		padding: 0 32upx;
		height: 33rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 33rpx;
		color: #999999;
		opacity: 1;
		margin-top: 18rpx;
	}

	/* 文章标题 end */

	/* 文章详情 start */
	.article-detail {
		margin: 32upx 32upx 24upx;
		color: #666666;
		font-size: 28upx;
		line-height: 48upx;
	}

	/* 文章详情 end */
</style>
